import axios from '~plugins/axios';

/**
 * 状态初始化
 * @type {{list: Array}}
 */
export const state = {
    list: []
};
/**
 * 提交更改
 * @type {{queryList: ((state))}}
 */
export const mutations = {
    SET_LIST: (state, list) => {
        state.list = list;
    }
};
/**
 * 数据查询或更新
 * @type {{}}
 */
export const actions = {
    list({commit}) {
        return axios.get('/api/dict').then((res) => {
            commit('SET_LIST', res.data);
        });
    }
};
/**
 * 获取信息
 * @type {{get: ((state))}}
 */
export const getters = {
    list(state) {
        return state.list;
    }
};